package com.wxp.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.wxp.dao.ResourceDao;
import com.wxp.entity.Resource;
import com.wxp.service.ResourceService;

@Service
@Transactional
public class ResourceServiceImpl implements ResourceService{
	
	@Autowired
	private ResourceDao resourceDao;


	@Override
	public void save(Resource resource) {
		resourceDao.save(resource);
		
	}


	@Override
	public Resource find(String operator) {
		return resourceDao.findFirstByoperator(operator);
	}


	@Override
	public List<Resource> findAll() {
		return resourceDao.findAll();
	}


	@Override
	public Page<Resource> findAll(Specification spec, PageRequest pageRequest) {
		return resourceDao.findAll(spec,pageRequest);
	}


	@Override
	public List<Resource> findAll(String roleCode) {
		return resourceDao.findAll(roleCode);
	}

}
